//
//  groupController.m
//  itheima_寻宝之旅_4.5(OC)
//
//  Created by 肖祺 on 16/4/7.
//  Copyright © 2016年 肖祺. All rights reserved.
//

#import "groupController.h"
#import "Masonry.h"

#define CZwidth  [UIScreen mainScreen].bounds.size.width

@implementation groupController



-(void)viewWillLayoutSubviews{
    
    [super viewWillLayoutSubviews];
    
    UIScrollView *Main = [[UIScrollView alloc]init];
    Main.contentSize = CGSizeMake(0, 1100);
    Main.backgroundColor = [UIColor lightGrayColor];
    
    [self.view addSubview:Main];
    Main.translatesAutoresizingMaskIntoConstraints = false;
    
    //设置约束
    [Main mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.leading.right.equalTo(self.view);
        make.height.mas_equalTo(1000);
        
        
    }];
    
    
    
    
    
    
    //红色View
    UIView *redHeadView = [[UIView alloc]initWithFrame:CGRectMake(0,65,CZwidth, 100)];
    redHeadView.backgroundColor = [UIColor redColor];
    
    [Main addSubview:redHeadView];
    
    redHeadView.translatesAutoresizingMaskIntoConstraints = false;
    
    //设置约束

    CGFloat margin = 30;
    CGFloat LabelWidth = (CZwidth - 4 * margin) / 3;
    
    CGFloat margin2 = 20;
    CGFloat Label2Width = (CZwidth - 4 * margin2) / 3;
    
    UILabel *firstLabel = [[UILabel alloc]initWithFrame:CGRectMake(margin, 30, LabelWidth, 10)];
    firstLabel.text = @"投资中金额(元)";
    firstLabel.textColor = [UIColor whiteColor];
    firstLabel.font = [UIFont systemFontOfSize:12];
    
    [redHeadView addSubview:firstLabel];
    
    UILabel *secondLabel = [[UILabel alloc]initWithFrame:CGRectMake(margin + (margin + LabelWidth), 30, LabelWidth, 10)];
    secondLabel.text = @"投资中金额(元)";
    secondLabel.textColor = [UIColor whiteColor];
    secondLabel.font = [UIFont systemFontOfSize:12];
    
    [redHeadView addSubview:secondLabel];
    
    UILabel *thirdLabel = [[UILabel alloc]initWithFrame:CGRectMake(margin + (margin + LabelWidth) * 2, 30, LabelWidth, 10)];
    thirdLabel.text = @"投资中金额(元)";
    thirdLabel.textColor = [UIColor whiteColor];
    thirdLabel.font = [UIFont systemFontOfSize:12];
    
    [redHeadView addSubview:thirdLabel];


    UILabel *firstNum = [[UILabel alloc]initWithFrame:CGRectMake(margin2 + (margin2 + Label2Width) * 0 + 25, 45, Label2Width, 10)];
    firstNum.text = @"00:00";
    firstNum.textColor = [UIColor whiteColor];
    firstNum.font = [UIFont systemFontOfSize:12];
    
    [redHeadView addSubview:firstNum];
    
    UILabel *secondNum = [[UILabel alloc]initWithFrame:CGRectMake(margin2 + (margin2 + Label2Width) * 1 + 25, 45, Label2Width, 10)];
    secondNum.text = @"00:00";
    secondNum.textColor = [UIColor whiteColor];
    secondNum.font = [UIFont systemFontOfSize:12];
    
    [redHeadView addSubview:secondNum];
    
    UILabel *thirdNum = [[UILabel alloc]initWithFrame:CGRectMake(margin2 + (margin2 + Label2Width) * 2 + 25, 45, Label2Width, 10)];
    thirdNum.text = @"00:00";
    thirdNum.textColor = [UIColor whiteColor];
    thirdNum.font = [UIFont systemFontOfSize:12];
    
    [redHeadView addSubview:thirdNum];
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(redHeadView.frame) + 10, CZwidth, 70)];
    
    view.backgroundColor = [UIColor whiteColor];
    
    UILabel *buyLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 30, 100, 20)];
    buyLabel.text = @"暂无购买记录";
    buyLabel.textColor = [UIColor blackColor];
    buyLabel.font = [UIFont systemFontOfSize:12];
    
    [view addSubview:buyLabel];
    
    [Main addSubview:view];
    
    
}



@end
